<?php

namespace hiduoke\services;

use app\common\model\system\Config;
use hiduoke\services\upload\Upload;

class UploadService
{

    /**
     * @var array
     */
    protected static $upload = [];

    public static function init()
    {
        $config = Config::get('remote');
        $type = $config['type'] ?? 'local';
        if (isset(self::$upload['upload_' . $type])) {
            return self::$upload['upload_' . $type];
        }
        return self::$upload['upload_' . $type] = new Upload($type, $config);
    }
}
